package com.xjtu.platform.security.register.Impl;

import com.xjtu.platform.common.Result;
import com.xjtu.platform.security.register.RegisterDto;
import com.xjtu.platform.security.register.RegisterService;
import com.xjtu.platform.security.register.dao.RegisterDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class RegisterServiceImpl implements RegisterService {

    @Resource
    private RegisterDao registerDao;

    @Override
    public boolean register(RegisterDto dto) {
        boolean ok = registerDao.updateEmail(dto);
        if (ok){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public long getCachetime(String user_id) {
        try {
            return registerDao.getCachetime(user_id);
        }catch (Exception e){
            e.printStackTrace();
            return 0;
        }
    }
}
